package cn.hsw.manage.permission.vo;

import cn.hsw.component.web.validated.annotations.MustIn;
import cn.hsw.component.web.validated.annotations.MustOnly;
import cn.hsw.manage.constant.ManageConstant;
import cn.hsw.manage.permission.service.PermissionService;
import lombok.Data;

import javax.validation.constraints.NotEmpty;

/**
 * 权限传输对象，作用于接口接收值
 * @author 李子木
 * @date 2020-11-04
 */
@Data
public class PermissionVO {

    /**
     * 名称
     */
    @NotEmpty(message = "名称不能为空")
    private String name;

    /**
     * 地址url
     */
    private String url;

    /**
     * 权限code
     */
    @MustOnly(message = "权限code已经存在",beanClass = PermissionService.class,method="findByCode")
    private String code;
    /**
     * 类型
     *      ManageConstant.PERMISSION_TYPE_MENU
     *      ManageConstant.PERMISSION_TYPE_PAGE
     *      ManageConstant.PERMISSION_TYPE_API
     */
    @MustIn(message = "类型必须是"+ ManageConstant.PERMISSION_TYPE_MENU +ManageConstant.PERMISSION_TYPE_PAGE+ManageConstant.PERMISSION_TYPE_API,types = {ManageConstant.PERMISSION_TYPE_MENU+"",ManageConstant.PERMISSION_TYPE_PAGE+"",ManageConstant.PERMISSION_TYPE_API+""})
    private Integer type;

    /**
     * 排序
     */
    private Integer sort;

    private Long parentPid;

    @MustIn(message = "状态必须是"+ManageConstant.PERMISSION_STATE_SHOW +ManageConstant.PERMISSION_STATE_NOT_SHOW,types = {ManageConstant.PERMISSION_STATE_SHOW+"",ManageConstant.PERMISSION_STATE_NOT_SHOW+""})
    private Integer state;

    private String remark;
}
